/**
  ******************************************************************************
  * @file           : sdiobsp.h
  * @brief          : Header for sdiobsp.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __SDIOBSP_H
#define __SDIOBSP_H

//#define FS_ERROR_LOG              0
//#define FS_DEBUG_LOG              0
#define SYS_DEBUG_SDIO_LEVEL      0

#define SDCARD_NOT_DETECTED       1
#define SDCARD_DETECTED           0

#define SDIO_CD_Pin               GPIO_PIN_3
#define SDIO_CD_LL_Pin            LL_GPIO_PIN_3
#define SDIO_CD_GPIO_Port         GPIOD
#define sd_card_detect()          (SDIO_CD_GPIO_Port->IDR & SDIO_CD_Pin)

extern void sdio_init(void);
extern void sd_detect_init(void);

/* fs ernet debug macro */
#ifdef FS_INFO_LOG
  #define  FsInfLog(...)     _printf("[FS  INF]:");_printf(__VA_ARGS__);
#else
  #define FsInfLog(...)
#endif

#ifdef FS_DEBUG_LOG
  #define  FsDbgLog(...)      _printf("[FS  DBG]:");_printf(__VA_ARGS__);                           
#else
  #define FsDbgLog(...)
#endif

#ifdef FS_ERROR_LOG
  #define  FsErrLog(...)      _printf("[FS  ERR]:");_printf(__VA_ARGS__);
#else
  #define FsErrLog(...)
#endif

#if (SYS_DEBUG_SDIO_LEVEL > 0)
#define  sysdbg_sdio_info(...)    printf("[SD  INF]: "__VA_ARGS__);

#else
#define sysdbg_sdio_info(...)   
#endif 
                            
#if (SYS_DEBUG_SDIO_LEVEL > 1)                         
#define  sysdbg_sdio_log(...)    printf(__VA_ARGS__);//_printf("[D]:") ;
                           
#else
#define sysdbg_sdio_log(...)                         
#endif

#ifdef SYS_SDIO_ERRLOG
#define  sysdbg_sdio_err(...)    _printf("[E] '%s' '%s' '%d':\r\n", __FILE__, __FUNCTION__, __LINE__) ;\
                           _printf(__VA_ARGS__);
#else
#define sysdbg_sdio_err(...)   
#endif

#endif /* __SDIOBSP_H */
